<extend name="Public/base" />

<block name="body">
	<!-- 标题栏 -->
	<div class="main-title">
		<h2>恒指期权订单</h2>
	</div>
	<form method = "post" action = "{:U('FuturesQqlcd/del')}">
	<div class="cf">
		<div class="fl">
            <a class="btn" href = "javascript:dow(0)">导出</a>
            <button class="btn confirm" target-form="ids">删 除</button>
            <span style = "width:150px;display:inline-block">金额：<i style = "color:red">{$topmoney}</i> 元</span>
            <span style = "width:150px;display:inline-block">客户盈利：<i style = "color:red">{$ying}</i> 元</span>
            <span style = "width:150px;display:inline-block">客户亏损：<i style = "color:red">{$kui}</i> 元</span>
        </div>
        <!-- 高级搜索 -->
        <div class="search-form fr cf">
            <div class="sleft">
                <select name="status" id="status">
                    <option value="-1" <if condition="$status eq -1">selected</if>  style="width:200px">状态选择</option>
                    <option value="1" <if condition="$status eq 1">selected</if>  style="width:200px">进行中</option>
                    <option value="2" <if condition="$status eq 2">selected</if>  style="width:200px">已结束</option>
                </select>
            </div>
            <div class="sleft">
                <select name="direction" id="direction">
                    <option value="-1" <if condition="$direction eq -1">selected</if>  style="width:200px">方向选择</option>
                    <option value="1" <if condition="$direction eq 1">selected</if>  style="width:200px">涨</option>
                    <option value="2" <if condition="$direction eq 2">selected</if>  style="width:200px">跌</option>
                </select>
            </div>
            <div class="sleft">
                <input type="text" name="name" id = "name" class="search-input" value="{:I('name')}" placeholder="用户名称">
            </div>
            <div class="sleft">
                <input type="text" name="option" id = "option" class="search-input" value="{:I('option')}" placeholder="合约">
            </div>
            <div class="sleft">
                <input type="text" id="create_time" name="start_time"  class="search-input" value="{:I('start_time')}" placeholder="开始时间">
            </div>
            <div class="sleft">
                <input type="text" id="end_time" name="end_time"  class="search-input" value="{:I('end_time')}" placeholder="结束时间">
            </div>
            <div class="sleft">
                <a class="sch-btn" href="javascript:;" id="search" url="{:U('index')}"><i class="btn-search"></i></a>
            </div>
        </div>
    </div>
    <!-- 数据列表 -->
    <div class="data-table table-striped">
	<table class="">
    <thead>
        <tr>
		<th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>
		<th class="">id</th>
		<th class="">用户</th>
        <th class="">合约</th>
        <th class="">合约代码</th>
		<th class="">金额</th>
		<th class="">当前卖价</th>
        <th class="">平仓买价</th>
        <th class="">方向</th>
        <th class="">盈利</th>
        <th class="">时长</th>
        <th class="">收益率</th>
        <th class="">状态</th>
        <th class="">开始时间</th>
		<th class="">结束时间</th>
		</tr>
    </thead>
    <tbody>
		<notempty name="list">
		<volist name="list" id="vo">
		<tr>
            <td><input class="ids" type="checkbox" name="ids[]" value="{$vo.id}" /></td>
            <td>{$vo.id} </td>
			<td>{$vo.user} </td>
			<td>{$vo.option}</td>
			<td>{$vo.code}</td>
            <td>{$vo.invest}<span>元</span></td>
            <td>{$vo.buy_price}<span>元</span></td>
            <td>{$vo.sell_price}<span>元</span></td>
            <td>
				<if condition="$vo.direction == 1">
					看涨
				<elseif  condition="$vo.direction == 0"/>
					看跌
				<elseif  condition="$vo.direction == 2"/>
					2
				</if>
			</td>
            <td>{$vo.profit}<span>元</span></td>
            <td>{$vo.duration}<span>秒</span></td>
            <td>{$vo.yield_rate}</td>
            <td>
            	<if condition="$vo.status == 1">
					进行中
				<elseif  condition="$vo.status == 2"/>
					已结束
				</if>
            </td>
			<td><span>{$vo.start_time|date="Y-m-d H:i:s",###}</span></td>
            <td><span>{$vo.end_time|date="Y-m-d H:i:s",###}</span></td>
			<!-- <td><span>{$vo.end_time|time_format}</span></td> -->
		</tr>
		</volist>
		<else/>
		<td colspan="9" class="text-center"> aOh! 暂时还没有内容! </td>
		</notempty>
	</tbody>
    </table> 
	</div>
	</form>
    <div class="page">
        {$_page}
    </div>
</block>

<block name="script">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css?v={:SITE_VERSION}" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css?v={:SITE_VERSION}" rel="stylesheet" type="text/css">';</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css?v={:SITE_VERSION}" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js?v={:SITE_VERSION}" charset="UTF-8"></script>
	<script src="__STATIC__/thinkbox/jquery.thinkbox.js?v={:SITE_VERSION}"></script>
	<script type="text/javascript">
	 $('#begin_time,#end_time,#create_time').datetimepicker({
            format: 'yyyy-mm-dd',
            language:"zh-CN",
            minView:2,
            autoclose:true,
        });
	 //搜索功能
        $("#search").click(function(){
            var url = $(this).attr('url');
            url = url.substr(0,url.lastIndexOf('.'));
            var query  = $('.search-form').find('input').serialize();
            var status=$('#status').val();
            var direction = $('#direction').val();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
            query = query.replace(/^&/g,'');
            query+="/status/"+status;
            query+="/direction/"+direction;
            query = query.replace(/=/gm,"/");
            query = query.replace(/&/gm,"/");
            if( url.indexOf('?')>0 ){
            	if(query.substr(0,1) != "/"){
            		url += "/"+query;
            	}else{
            		url += query;
            	}
            }else{
                url += "/" + query;
            }
            window.location.href = url;
        });
        //回车搜索
        $(".search-input").keyup(function(e){
            if(e.keyCode === 13){
                $("#search").click();
                return false;
            }
        });
        function dow(){
        	var get = "";
        	var status = $('#status').val();
        	if(status){
        		get += "/status/"+status;
        	}
        	var direction = $('#direction').val();
        	if(direction){
        		get += "/direction/"+direction;
        	}
        	var name = $('#name').val();
        	if(name){
        		get += "/name/"+name;
        	}
        	var option = $('#option').val();
        	if(option){
        		get += "/option/"+option;
        	}
        	var start_time = $('#create_time').val();
        	if(start_time){
        		get += "/start_time/"+start_time;
        	}
        	var end_time = $('#end_time').val();
        	if(end_time){
        		get += "/end_time/"+end_time;
        	}
        	url = "{:U('FuturesQqlcd/downexecl')}";
        	url = url.substr(0,url.lastIndexOf('.'))+get;
			window.location.href=url;
        }
    //导航高亮
    $('.side-sub-menu').find('a[href="{:U('FuturesQqlcd/index')}"]').closest('li').addClass('current');
	</script>
</block>
